<?php
	session_start();
?>
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	</head>
<?php
	include ('include/conn.php');
	include ('include/config.php');
	$username=$_POST['username'];
	$password=$_POST['password'];
 
	if(trim($username) =="")
	{
		echo <<<aaa
				<script language="javascript">
					alert('错误，请重新登录');
					history.go(-1);
				</script>
aaa;
	}	
	
	$check="SELECT psd
	FROM admin
	WHERE usr= '$username'  ";
	$a=mysql_query($check);
	$num=mysql_num_rows($a);
	if($num>0)
	{
		if($a) 
		{
			$pass = mysql_result($a,0,0);
			if($pass==$password)
			{
				$_SESSION['username'] = $user;
				
				echo <<<bbb
					<script language="javascript">
					alert('登录成功');
					location.href='admin_index.php';
					</script>
bbb;
			}
			else
			{
				echo <<<ccc
					<script language="javascript">
						alert('错误，请重新登录');
						history.go(-1);
					</script>
ccc;
			}
		}
	}
	else
	{
			echo <<<ddd
			<script language="javascript">
				alert('非法登录');
				history.go(-1);
			</script>
ddd;
	}


?>